package ex4.multiThread;

class MyThreadDemo2 implements Runnable { // 线程的主体类
	private String title; // 成员属性

	public MyThreadDemo2(String title) { // 属性初始化
		this.title = title;
	}

	@Override
	public void run() { // 【方法覆写】线程方法
		for (int x = 0; x < 10; x++) {
			System.out.println(this.title + "运行，x = " + x);
		}
	}
}

public class MutiThreadDemo2 {
	public static void main(String[] args) {
		Thread threadA = new Thread(new MyThreadDemo2("线程对象A"));
		Thread threadB = new Thread(new MyThreadDemo2("线程对象B"));
		Thread threadC = new Thread(new MyThreadDemo2("线程对象C"));
		threadA.start(); // 启动多线程
		threadB.start(); // 启动多线程
		threadC.start(); // 启动多线程
	}
}
